package autumn.recruit;

import java.math.BigInteger;
import java.util.Scanner;

/**
 * @author dangqi
 * @date 2021/8/22 19:04
 */
public class PDD {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int T = sc.nextInt();
        String[] res = new String[T];
        for (int i = 0; i < T; i++) {
            res[i] = slove(sc.nextInt(), sc.next());
        }
        for (int i = 0; i < res.length; i++) {
            System.out.println(res[i]);
        }
    }
    private static  BigInteger TEN= new BigInteger(String.valueOf(10));
    private static  BigInteger NINE= new BigInteger(String.valueOf(9));
    private static  BigInteger FONE= new BigInteger(String.valueOf(-1));
    public static String slove(int N, String m){
        BigInteger M = new BigInteger(m);
        BigInteger minN = TEN.pow(N-1);
        BigInteger d = minN.divide(M);
        BigInteger k = d.multiply(M);
        BigInteger max = minN.multiply(TEN);
        if(k.compareTo(minN) < 0){
            BigInteger r =(d.add(BigInteger.ONE)).multiply(M);
            if(r.compareTo(minN)>=0 ){

                if(r.compareTo(max) <0){
                    return r.toString();
                }
            }
            else return  "-1";
        }
        else if(k.equals(minN) )return minN.toString();
        return "-1";
    }
}
